package com.lucas.servlet.chapter5.controller;

import com.lucas.servlet.chapter5.entity.Student;
import com.lucas.servlet.chapter5.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;


@RestController
public class StudentController {
    @Autowired
    StudentMapper studentMapper;
    //@RequestMapping(value = "/students/{id}", method= RequestMethod.GET)
    @GetMapping(value ="/students/{id}" )
    public Object student(@PathVariable("id") int id){
        return studentMapper.getStudentById(id);
    }
}
